#include <iostream>
using namespace std;
class person {
public:
    void test()
    {
        cout << "person test" << endl;
    }
protected:
    int _age = 20;
    char _name[64] = "张三";
    int _num = 222;

};

class Student :public person {
public:
    void test(int i)
    {
        cout << "student test" << endl;
    }
    void func()
    {
        cout << "年龄" << _age << endl;
        cout << "名字 " << _name << endl;
        cout << "_num " << _num << endl;
        cout << "Person::_num" << person::_num << endl;
        test(2);
        person::test();
    }

protected:
    int _num = 111;
};
//
//
//
//int main()
//{
//    //int a = 10;
//    //double d = a;  //int --> double
//    //const double& rd = a; //报错
//
//    //Student s1;
//    //person p = s1;  //此时这里就完成一次切片操作
//    //person& rp = s1; //引用方式
//    Student s1;
//    s1.func();
//    return 0;
//}

//class B;
//class A {
//public:
//	friend void func(const A& a, const B& b);  //友元函数
//protected:
//	int _num = 10;
//private:
//	int _age = 20;
//};
//
//class B :public A
//{
//protected:
//	char name[64] = "zhangsan";
//};
//
//void func(const A& a, const B& b)
//{
//	cout << "a._num" << a._num << endl; //访问a的保护成员
//	cout << "a._age = " << a._age << endl; //访问a的私有成员
//	cout << "b.name" << b.name << endl;
//}
//
//int main()
//{
//	A a;
//	B b;
//	func(a,b);
//	return 0;
//}